package com.cskaoyan.controller;

import com.cskaoyan.bean.CskaoyanmallFeedback;
import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.mapper.CskaoyanmallUserMapper;
import com.cskaoyan.service.WxFeedbackService;
import com.cskaoyan.utils.QueryUserIdByUserNameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class WxFeedbackController {

    @Autowired
    CskaoyanmallUserMapper userMapper;

    @Autowired
    WxFeedbackService service;


    @PostMapping("wx/feedback/submit")
    public BaseRespVo feedBack(@RequestBody CskaoyanmallFeedback feedback){

        Integer userId = QueryUserIdByUserNameUtils.queryName(userMapper);

        service.submitFeedback(feedback, userId);

        return BaseRespVo.success();
    }
}
